  <template>
  <div id="standby_page">
    <div class="group_content">
      <div class="header">
        <div class="left"></div>
        <div class="group_name">快开始聊天吧</div>
        <div class="right"></div>
      </div>
      <div class="content">
        <div class="img">
<!--          <img src="https://picsum.photos/500/500.webp" />-->
          <img :src="url[num]">
        </div>
        <div class="title">人生有梦&nbsp;&nbsp;&nbsp;各自精彩</div>
      </div>
      <div class="input_box">
        <el-input
          type="textarea"
          autosize
          placeholder="请输入内容"
          v-model="textarea"
          class="resizeNone"
          autofocus="true"
          @keydown.enter.native="enterDown($event)"
        >
        </el-input>
        <div
          :class="textarea ? 'send_button' : 'send_button_n'"
          @click="textarea = ''"
        >
          发送
        </div>
      </div>
    </div>
    <div class="group_details"></div>
  </div>
</template>

<script>
  export default {
    name: 'StandbyPage',
    data() {
      return {
        textarea: '',  //用户输入的聊天内容
        num: 0,        //0-9之间的随机整数
        //随机图片地址引入

        url: [
          require('@/assets/images/01.png'),
          require('@/assets/images/02.png'),
          require('@/assets/images/03.png'),
          require('@/assets/images/04.png'),
          require('@/assets/images/05.png'),
          require('@/assets/images/06.png'),
          require('@/assets/images/07.png'),
          require('@/assets/images/08.png'),
          require('@/assets/images/09.png'),
          require('@/assets/images/10.png'),
        ]
      }
    },
    methods: {
      //点击回车取消textarea默认事件，并且发送消息
      enterDown(event) {
        if (event.key == 'Enter') {
          event.returnValue = false
          this.textarea = ''
        }
      },
    },
    created() {
      this.num = Math.floor(Math.random() * 10)
    }
  }
</script>

<style scoped>
  #standby_page {
    flex: 1;
    display: flex;
    height: 100vh;
  }
  .group_content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: #36393f;
    overflow: hidden;
  }
  .content {
    flex: 1;
    /* max-height: 80vh; */
    text-align: center;
  }

  .content .img img {
    width: 500px;
    height: 500px;
  }
  .content .title {
    margin: 0 auto;
    font-weight: 800;
    font-size: 36px;
    color: #969ca5;
  }
  .group_content .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
    box-shadow: 0 1px 0 rgba(4, 4, 5, 0.2), 0 1.5px 0 rgba(6, 6, 7, 0.05),
      0 2px 0 rgba(4, 4, 5, 0.05);
  }
  .header .left,
  .header .right {
    width: 48px;
    height: 48px;
  }
  .header .group_name {
    flex: 1;
    text-align: center;
    font-weight: 800;
    color: #fff;
  }

  /* 聊天输入框 */
  .group_content .input_box {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
    padding: 0 15px;
  }
  .input_box .resizeNone {
    position: relative;
    width: 93%;
  }
  .input_box .resizeNone /deep/ .el-textarea__inner {
    min-height: 44px !important;
    max-height: 135px !important;
    border: 0;
    margin-bottom: 20px;
    padding-right: 40px;
    background-color: #40444b;
    color: #c0c4cc;
    resize: none;
  }
  .input_box .resizeNone /deep/ .el-textarea__inner::-webkit-scrollbar {
    width: 4px;
    /* height: 4px; */
  }
  .input_box .resizeNone /deep/ .el-textarea__inner::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: rgb(46, 45, 45);
  }
  /* 表情框 */
  .emoticon {
    position: absolute;
    top: 0;
    right: 4px;
    width: 28px;
    height: 28px;
    margin: 8px 5px 0 5px;
    border-radius: 50%;
    cursor: pointer;
  }
  .emoticon svg {
    width: 100%;
    height: 100%;
  }
  /* 发送消息按钮 */
  .input_box .send_button {
    width: 5%;
    height: 34px;
    margin-top: 5px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    line-height: 34px;
    background-color: #5865f2;
    color: #fff;
    cursor: pointer;
  }
  .input_box .send_button_n {
    width: 5%;
    height: 34px;
    margin-top: 5px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    line-height: 34px;
    background-color: #444c95;
    color: #97999b;
    cursor: not-allowed;
  }
  /* 右边群展示框 */
  .group_details {
    width: 312px;
    background: #2f3136;
  }
</style>